//
//  LKBaseTableViewController.m
//  YLHelper
//
//  Created by she1323 on 2018/4/10.
//  Copyright © 2018年 she1323. All rights reserved.
//

#import "LKBaseTableViewController.h"

@interface LKBaseTableViewController ()

@property (nonatomic, assign) BOOL canShowNoData;

@end

@implementation LKBaseTableViewController

- (void)setEmpty
{
    if (_canShowNoData) {
        self.tableView.emptyDataSetSource = self;
        self.tableView.emptyDataSetDelegate = self;
        _canShowNoData = NO;
    }
}

- (void)viewDidLoad {
    [super viewDidLoad];
    _canShowNoData = YES;
    
    
    // Uncomment the following line to preserve selection between presentations.
    // self.clearsSelectionOnViewWillAppear = NO;
    
    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 0;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 0;
}


- (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView
{
    NSString * text = @"暂时还没有相关数据!";
    
    NSDictionary * attributes = @ { NSFontAttributeName:[UIFont boldSystemFontOfSize:16.0f ],
        NSForegroundColorAttributeName:[UIColor clearColor]};
    
    return [[ NSAttributedString  alloc ] initWithString:text attributes:attributes];
}


- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView
{
    return [UIImage imageNamed:@"nodata"];
}

- (CGFloat)spaceHeightForEmptyDataSet:(UIScrollView *)scrollView
{
    return 25.0f;
}


- (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView
{
    return 0;
}

@end
